package wfm.entities;

import java.io.Serializable;

import javax.inject.Named;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
@Named
public class Ticket  implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -4071658166646581565L;
	
	private Customer customer;
	private String description;
	private int fault; 
	private String predictionFault;
	private String renterInformation;
	private int id; 
	private double estimatedRepairDuration; 
	private double actualRepairDuration; 
	private Partner selectedPartner; 
	private Worker assignedWorker;
	private double estimatedCosts; 
	private double actualCosts; 
	private String typeOfDamage; 
	private String messagePaymentFailure;
	private String checkWorkDoneInformation;
	private String protocolEndNotes;
	private String superVisorNote;
	private String surveyorDescription;
	
	public Ticket(){
		
	}
	public Ticket(String firstName, String lastName, String street, String city, String zip, String country, String telNo, String mailAddress, String description)
	{
		this.customer = new Customer(firstName,lastName,new Address(street,city,zip,country),telNo,mailAddress);
		this.description = description;
	}
	
	public Ticket(Customer cust){
		this.customer=cust;
	}
	
	public Customer getCustomer() {
		return customer;
	}
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
	
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public int getFault() {
		return fault;
	}
	public void setFault(int fault) {
		this.fault = fault;
	}
	public String getPredictionFault() {
		return predictionFault;
	}
	public void setPredictionFault(String predictionFault) {
		this.predictionFault = predictionFault;
	}
	public String getRenterInformation() {
		return renterInformation;
	}
	public void setRenterInformation(String renterInformation) {
		this.renterInformation = renterInformation;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	
	public double getEstimatedRepairDuration() {
		return estimatedRepairDuration;
	}
	public void setEstimatedRepairDuration(double estimatedRepairDuration) {
		this.estimatedRepairDuration = estimatedRepairDuration;
	}
	public Partner getSelectedPartner() {
		return selectedPartner;
	}
	public void setSelectedPartner(Partner selectedPartner) {
		this.selectedPartner = selectedPartner;
	}
	
	public double getActualRepairDuration() {
		return actualRepairDuration;
	}
	public void setActualRepairDuration(double actualRepairDuration) {
		this.actualRepairDuration = actualRepairDuration;
	}
	public Worker getAssignedWorker() {
		return assignedWorker;
	}
	public void setAssignedWorker(Worker assignedWorker) {
		this.assignedWorker = assignedWorker;
	}
	public double getEstimatedCosts() {
		return estimatedCosts;
	}
	public void setEstimatedCosts(double estimatedCosts) {
		this.estimatedCosts = estimatedCosts;
	}
	public double getActualCosts() {
		return actualCosts;
	}
	public void setActualCosts(double actualCosts) {
		this.actualCosts = actualCosts;
	}
	public String getTypeOfDamage() {
		return typeOfDamage;
	}
	public void setTypeOfDamage(String typeOfDamage) {
		this.typeOfDamage = typeOfDamage;
	}
	public String getMessagePaymentFailure() {
		return messagePaymentFailure;
	}
	public void setMessagePaymentFailure(String messagePaymentFailure) {
		this.messagePaymentFailure = messagePaymentFailure;
	}
	public String getCheckWorkDoneInformation() {
		return checkWorkDoneInformation;
	}
	public void setCheckWorkDoneInformation(String checkWorkDoneInformation) {
		this.checkWorkDoneInformation = checkWorkDoneInformation;
	}
	public String getProtocolEndNotes() {
		return protocolEndNotes;
	}
	public void setProtocolEndNotes(String protocolEndNotes) {
		this.protocolEndNotes = protocolEndNotes;
	}
	public String getSuperVisorNote() {
		return superVisorNote;
	}
	public void setSuperVisorNote(String superVisorNote) {
		this.superVisorNote = superVisorNote;
	}
	public String getSurveyorDescription() {
		return surveyorDescription;
	}
	public void setSurveyorDescription(String surveyorDescription) {
		this.surveyorDescription = surveyorDescription;
	}	
	
	public String faultDescription(){
		if(fault==1){
			return "personal negligence";
		}
		else if (fault==2){
			return "third party negligence";
		}
		
		return "";
	}
	
	public String typeOfDamageDescription(){
		String description = ""; 
		switch(Integer.parseInt(this.typeOfDamage)){
			case 1: description = "electro defect";break; 
			case 2: description = "water damage";break; 
			case 3: description = "fire damage";break; 
			case 4: description = "gas defect";break; 
			case 5: description = "mold"; break; 
			default: description = "undefined"; 
		}
		
		return description; 
	}
	
}
